package ro.isdc.navigator;

import ro.isdc.navigator.exceptions.SearchLimitExceededException;

/**
 * Page Navigator Interface
 * 
 * @author Andrei Chirila
 */
public interface IPagesNavigator<T> {
	/**
	 * Gets the next page relative to the current one
	 * 
	 * @return the next page
	 * @throws SearchLimitExceededException if the search limit has been exceeded 
	 */
	Page<T> getNext()throws SearchLimitExceededException;
	
	/**
	 * Gets the previous page relative to the current one
	 * 
	 * @return the previous page
	 * @throws SearchLimitExceededException if the search limit has been exceeded 
	 */
	Page<T> getPrevious()throws SearchLimitExceededException;
	
	/**
	 * @return true if there is a previous page and false otherwise
	 */
	boolean hasPrevious();
	
	/**
	 * @return true if there is a next page and false otherwise
	 */
	boolean hasNext();
	
	/**
	 * Gets the page specified by its pageNumber.
	 *
	 * @param pageNumber a 1-based index
	 * @return the page corresponding to the given index
	 * @throws SearchLimitExceededException if the search limit has been exceeded 
	 */
	Page<T> getPage(int pageNumber) throws SearchLimitExceededException;
	
	/**
	 * @return the number of total pages
	 */
	int getPagesCount();
	
}
